<?php
class Member_nodeAction extends CommonAction {
	function index(){
		$this->list=D('Node')->getList();
		$this->display();
	}
	public function add(){
        $this->dao=D('Node');
		$this->pid = $this->_get('pid');
		$this->level = $this->_get('level');
		$this->s_gid=M('Menugroup')->select();
		$this->s_pid=D('Node')->getList();
		parent::add();
	}
	
	public function insert(){
        $this->dao=D('Node');
	    $map['level'] = $this->_post('level');
		$map['pid'] = $this->_post('pid');
		$map['name'] = $this->_post('name');
		$node = $this->dao -> where($map) -> find();
		if($node){
			$this->error('该节点已经存在！');
		}else{
		    parent::insert();
		}
    }
	
	public function edit(){
        $this->dao=D('Node'); 
		$this->s_pid=D('Node')->getList();
		$this->s_gid=M('Menugroup')->select();
		parent::edit();
	}
	
}
